Skip to content

[PHP] Resume db.sql downloads from the last saved file size - #591

Closed
adamziel wants to merge 1 commit into
codex/direct-db-pull-process-boundariesfrom
codex/file-db-pull-durable-resume
Closed

[PHP] Resume db.sql downloads from the last saved file size#591
adamziel wants to merge 1 commit into
codex/direct-db-pull-process-boundariesfrom
codex/file-db-pull-durable-resume

Conversation

@adamziel

@adamziel adamziel commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

File-backed db-pull can now continue from the last file size and source position Reprint saved.

Background

Exit code 2 left db-pull marked partial, but a later process only recognized in_progress and started over. A hard stop could also leave extra bytes at the end of db.sql, or leave the file shorter than the saved source position.

This change

Reprint flushes db.sql before saving its size with the matching source position. A later process removes any bytes written after that saved size, then continues the download. It refuses a missing or shorter file and refuses to change the output mode halfway through the download.

Every request asks the server for SQL which drops and recreates each dumped table. After the server finishes, database-dump.json stores the SHA-256 of the complete db.sql. db-apply will not read a file which is still downloading.

This is PR 2 of 5: #590#591#595#582#607.

Testing

The focused tests cover exit code 2 during database indexing, process death before and after the first saved file size, missing and shortened db.sql, an output-mode change, and an attempt to apply a download which has not finished.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.9

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 9.67 s 9.83 s ⚪ -163 ms (-1.7%) condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
trunk: condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
playground-sqlite-db-apply 3.70 s 3.73 s ⚪ -29 ms (-0.8%) condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
trunk: condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
Total 13.37 s 13.56 s ⚪ -191 ms (-1.4%)

Numbers carry runner noise; treat single-run deltas as directional, not authoritative.

📈 Trunk performance history — commit-by-commit timeline.

@adamziel
adamziel force-pushed the codex/direct-db-pull-process-boundaries branch from 7096470 to cec2413 Compare August 14, 2026 12:39
@adamziel
adamziel force-pushed the codex/file-db-pull-durable-resume branch 4 times, most recently from 710ae4e to 64c7cde Compare August 14, 2026 12:52
@adamziel adamziel changed the title [PHP] Resume file-backed db-pull from flushed cursor boundaries [PHP] Resume db.sql downloads from the last saved file size Aug 14, 2026
@adamziel

Copy link
Copy Markdown
Collaborator Author

Closing this draft. It is being replaced by a smaller target-database checkpoint stack.

@adamziel adamziel closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant